package cn.bdqn.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;



public class ConfigManager {

	private static ConfigManager configManager;

	private static Properties properties;

	private ConfigManager() {
		// 获取文件
		String configFile = "database.properties";
		properties = new Properties();
		// 把文件写入流
		InputStream in = ConfigManager.class.getClassLoader()
				.getResourceAsStream(configFile);

		try {
			// 读入流
			properties.load(in);
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static ConfigManager getInstance() {

		if (configManager == null) {
			configManager = new ConfigManager();
		}
		return configManager;
	}

	
	public String getString(String key) {
		return properties.getProperty(key);
	}

}